Skip to content

Conversation

@j-zimnowoda
Copy link
Contributor

@j-zimnowoda j-zimnowoda commented Nov 3, 2025

This change anticipate that workload values are not stored with the values | prefix.
e.g.
previous

values: | 
  a: b

current

a: b

depends-on: linode/apl-core#2642

@j-zimnowoda j-zimnowoda changed the title Apl 1195 1 feat: load workload values as is Nov 5, 2025

export function renderManifest(fileMap: FileMap, jsonPath: jsonpath.PathComponent[], data: Record<string, any>) {
//TODO remove this custom workaround for workloadValues
if (fileMap.kind === 'AplTeamWorkloadValues') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we completely remove the AplTeamWorkloadValues kind, or do we still need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can but it may be complicated at the moment. This kind is only used for loading and does not enforce any data structure that is reflected in values file.
What benefits from removing it now do you see?

Copy link
Contributor

@CasLubbers CasLubbers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small remarks

const filePath = getTeamWorkloadValuesFilePath(teamId, metadata.name)
await this.git.writeTextFile(filePath, data.spec.values || '{}')
const filePathValuesManaged = getTeamWorkloadValuesManagedFilePath(teamId, metadata.name)
await this.git.writeTextFile(filePathValuesManaged, '')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how the managed file should behave but this will always override the managed file to an empty file. I am assuming that its not correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point I did not realized that saveTeamWorkloadValues is also called by editAplWorkload and editWorkloadValues

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

const teamId = workload.metadata.labels?.['apl.io/teamId']

const filePath = getTeamWorkloadValuesFilePath(teamId, workloadName)
return merge(workload, { spec: { values: files[filePath] } })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these values: files is used right? We will always know what the workload values files are based on the functions: getTeamWorkloadValuesManagedFilePath and getTeamWorkloadValuesFilePath

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, they are. At lease this is what APL Console expects. Otherwise you won't see values in the code editor.

const fileMaps = getFileMaps(envDir)
const spec = {}
const spec = {
files: {},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is just a reference to the file we can remove it right? We always know what the files are based on the functions: getTeamWorkloadValuesFilePath and getTeamWorkloadValuesManagedFilePath

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required by loadToSpec to build the files map. I am open to suggestions though.

this.repo.users ??= []
this.repo.versions ??= {} as Versions
this.repo.teamConfig ??= {}
this.repo.files ??= {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not useful to store these file locations right? If we want to store them, these files are per workload right? So it should then be in the teamconfig

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to go for more straight forward solution where each file content in repo is reference by its file path.

In general this.repo.files is a map filePath => fileContent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand why api is trying to rebuild the teamConfig structure.
The API should work with separate files not structures that apl-core is using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants